package learnjava.concur.chapter123;
import java.util.ArrayList;

public class TestThreadSafe {

    public static void main(String[] args) {

        new Thread(()->{
            ArrayList<String> list = new ArrayList<>();
            for (int i = 0; i < 200; i++) {
                list.add("1");
                new Thread(() -> {
                    list.remove(0);
                }).start();
            }
        }).start();
    }
}

